/*
 * Copyright (C) 2010-2014 Enrique Lara (enrique.posix2.lara@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package trs.unknown;

import android.content.ContentUris;
import android.content.Context;

import android.database.Cursor;

import android.media.Ringtone;

import android.net.Uri;

import app.transittool.R;

import app.transittool.model.Agency;
import app.transittool.model.Alarm;
import app.transittool.model.App;
import app.transittool.model.Route;

import app.transittool.provider.Tables.Alarms;

import app.transittool.view.DaysOfWeek;

public final class UnknownAlarm implements Alarm {
    private int id = -1;
    private final Uri uri;
    private final Context context;

    UnknownAlarm(final Cursor cursor, final Context context) {
        this.context = context;
        id = cursor.getInt(0);
        uri = ContentUris.withAppendedId(Alarms.CONTENT_URI, id);
    }

    public UnknownAlarm(final Context context) {
        this.context = context;
        id = -1;
        uri = ContentUris.withAppendedId(Alarms.CONTENT_URI, -1);
    }

    @Override
    public void cancelAlarm() {
    }

    @Override
    public boolean delete() {
        if (id >= 0) {
            context.getContentResolver().delete(uri, null, null);
        }

        return true;
    }

    @Override
    public Agency getAgency() {
        return App.getAgency(-1, context);
    }

    @Override
    public String getDirection() {
        return "UKNOWN";
    }

    @Override
    public String getDirectionName() {
        return "UKNOWN";
    }

    @Override
    public int getHour() {
        return 0;
    }

    @Override
    public int getId() {
        return id;
    }

    @Override
    public int getImageId() {
        return R.drawable.ic_transit_alarm;
    }

    @Override
    public String getLabel() {
        return "UNKNOWN";
    }

    @Override
    public String getLabelOrStopName() {
        return "UNKNOWN";
    }

    @Override
    public int getMaxTime() {
        return 0;
    }

    @Override
    public int getMinTime() {
        return 0;
    }

    @Override
    public int getMinute() {
        return 0;
    }

    @Override
    public int getRepeat() {
        return 0;
    }

    @Override
    public String getRepeatStr() {
        return new DaysOfWeek(-1).getRepeatStr();
    }

    @Override
    public String getRingtone() {
        return "UNKNOWN";
    }

    @Override
    public Ringtone getRingtoneObj() {
        return null;
    }

    @Override
    public Route getRoute() {
        return UnknownAgency.UNKNOWN_ROUTE;
    }

    @Override
    public String getRouteCode() {
        return "UNKNOWN";
    }

    @Override
    public String getStopCode() {
        return "UNKNOWN";
    }

    @Override
    public String getStopName() {
        return "UNKNOWN";
    }

    @Override
    public String getTimeStr() {
        return "N/A";
    }

    @Override
    public Uri getUri() {
        return uri;
    }

    @Override
    public boolean gotoEdit() {
        return false;
    }

    @Override
    public boolean gotoView() {
        return false;
    }

    @Override
    public boolean gotoViewNearbyStops() {
        return false;
    }

    @Override
    public boolean isActiveToday() {
        return false;
    }

    @Override
    public boolean isDirty() {
        return false;
    }

    @Override
    public boolean isEnabled() {
        return false;
    }

    @Override
    public boolean isSilent() {
        return true;
    }

    @Override
    public boolean isVibrate() {
        return false;
    }

    @Override
    public void setDirection(final String direction) {
    }

    @Override
    public void setEnabled(final boolean enabled) {
    }

    @Override
    public void setHour(final int hour) {
    }

    @Override
    public void setImageId(final int resourceId) {
    }

    @Override
    public void setLabel(final String label) {
    }

    @Override
    public void setMaxTime(final int maxTime) {
    }

    @Override
    public void setMinTime(final int minTime) {
    }

    @Override
    public void setMinute(final int minute) {
    }

    @Override
    public void setRepeat(final int repeat) {
    }

    @Override
    public void setRingtone(final String ringtone) {
    }

    @Override
    public void setRoute(final String line) {
    }

    @Override
    public void setStop(final String stationCode) {
    }

    @Override
    public void setVibrate(final boolean vibrate) {
    }

    @Override
    public boolean startPollingIn(final int minutes) {
        return false;
    }

    @Override
    public boolean startPollingNow() {
        return false;
    }

    @Override
    public boolean update() {
        return true;
    }

    @Override
    public boolean updateQuiet() {
        return true;
    }
}
